home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 115_01.zip / ED7.C < prev    next >
Text File  |  1993-06-01  |  3KB  |  183 lines

  1. /* Screen editor:  prompt line module
  2.  *
  3.  * Source:  ed7.c
  4.  * Version: March 6, 1981.
  5.  */
  6.  
  7. /* Define the prompt line data */
  8.  
  9. char pmtln[MAXLEN];    /* mode */
  10. char pmtfn[SYSFNMAX];    /* file name */
  11.  
  12.  
  13. /* put error message on prompt line.
  14.  * wait for response.
  15.  */
  16.  
  17. pmtmess(s1,s2) char *s1, *s2;
  18. {
  19. int x,y;
  20.     /* save cursor */
  21.     x=outgetx();
  22.     y=outgety();
  23.     outxy(0,0);
  24.     /* make sure line is correct */
  25.     outdelln();
  26.     pmtline1();
  27.     pmtcol1(x);
  28.     /* output error message */
  29.     fmtsout(s1,outgetx());
  30.     fmtsout(s2,outgetx());
  31.     /* wait for input from console */
  32.     syscin();
  33.     /* redraw prompt line */
  34.     pmtline1();
  35.     pmtcol1(x);
  36.     pmtfile1(pmtfn);
  37.     pmtmode1(pmtln);
  38.     /* restore cursor */
  39.     outxy(x,y);
  40. }
  41.  
  42. /* write new mode message on prompt line */
  43.  
  44. pmtmode(s) char *s;
  45. {
  46. int x,y;        /* save cursor on entry */
  47.     /* save cursor */
  48.     x=outgetx();
  49.     y=outgety();
  50.     /* redraw whole line */
  51.     outxy(0,0);
  52.     outdelln();
  53.     pmtline1();
  54.     pmtcol1(x);
  55.     pmtfile1(pmtfn);
  56.     pmtmode1(s);
  57.     /* restore cursor */
  58.     outxy(x,y);
  59. }
  60.  
  61. /* update file name on prompt line */
  62.  
  63. pmtfile(s) char *s;
  64. {
  65. int x, y;
  66.     /* save cursor */
  67.     x=outgetx();
  68.     y=outgety();
  69.     /* update whole line */
  70.     outxy(0,0);
  71.     outdelln();
  72.     pmtline1();
  73.     pmtcol1();
  74.     pmtfile1(s);
  75.     pmtmode1(pmtln);
  76.     /* restore cursor */
  77.     outxy(x,y);
  78. }
  79.  
  80. /* change mode on prompt line to edit: */
  81.  
  82. pmtedit()
  83. {
  84.     pmtmode("edit:");
  85. }
  86.  
  87. /* update line and column numbers on prompt line */
  88.  
  89. pmtline()
  90. {
  91. int x,y;
  92.     /* save cursor */
  93.     x=outgetx();
  94.     y=outgety();
  95.     /* redraw whole line */
  96.     outxy(0,0);
  97.     outdelln();
  98.     pmtline1();
  99.     pmtcol1(x);
  100.     pmtfile1(pmtfn);
  101.     pmtmode1(pmtln);
  102.     /* restore cursor */
  103.     outxy(x,y);
  104. }
  105.  
  106. /* update just the column number on prompt line */
  107.  
  108. pmtcol()
  109. {
  110. int x,y;
  111.     /* save cursor */
  112.     x=outgetx();
  113.     y=outgety();
  114.     /* update column number */
  115.     pmtcol1(x);
  116.     /* update cursor */
  117.     outxy(x,y);
  118. }
  119.  
  120. /* update mode.  call getcmnd() to write on prompt line */
  121.  
  122. pmtcmnd(mode,buffer) char *mode, *buffer;
  123. {
  124. int x,y;
  125.     /* save cursor */
  126.     x=outgetx();
  127.     y=outgety();
  128.     pmtmode1(mode);
  129.     /* user types command on prompt line */
  130.     getcmnd(buffer,outgetx());
  131.     /* restore cursor */
  132. }
  133.  
  134. /* update and print mode */
  135.  
  136. pmtmode1(s) char *s;
  137. {
  138. int i;
  139.     outxy(40,0);
  140.     fmtsout(s,40);
  141.     i=0;
  142.     while (pmtln[i++]=*s++) {
  143.         ;
  144.     }
  145. }
  146.  
  147. /* print the file name on the prompt line */
  148.  
  149. pmtfile1(s) char *s;
  150. {
  151. int i;
  152.     outxy(25,0);
  153.     if (*s==EOS) {
  154.         fmtsout("no file",25);
  155.     }
  156.     else {
  157.         fmtsout(s,25);
  158.     }
  159.     i=0;
  160.     while (pmtfn[i++]=*s++) {
  161.         ;
  162.     }
  163. }
  164.  
  165. /* print the line number on the prompt line */
  166.  
  167. pmtline1()
  168. {
  169.     outxy(0,0);
  170.     fmtsout("line: ",0);
  171.     putdec(bufln(),5);
  172. }
  173.  
  174.  
  175. /* print column number of the cursor */
  176.  
  177. pmtcol1(x) int x;
  178. {
  179.     outxy(12,0);
  180.     fmtsout("column: ",12);
  181.     putdec(x,3);
  182. }
  183.